import React, { PureComponent } from "react"

export default class Son extends PureComponent {
  state = {
    msg: "hello",
    arr: [1, 2, 3],
  }

  render() {
    console.log("Son更新了")
    return (
      <>
        <h1>Son</h1>
        <ul>
          {this.state.arr.map((item,index)=>{
            return <li key={index}>{item}</li>
          })}
        </ul>
        <button onClick={()=>{
          const newArr = [...this.state.arr]
          newArr.push(8)
          this.setState({arr:newArr})}}>Son数据更新</button>
      </>
    )
  }
}
